<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>角色授权操作</title>
	<link href="../../../component/pear/css/pear.css" rel="stylesheet" />
</head>

<body class="pear-container">

	<!-- 角色授权表格 -->
	<div class="layui-card">
		<div class="layui-card-body">
			<div id="ID-tree-demo-showCheckbox"></div>
		</div>
	</div>

	<!-- 通用的js引入 -->
	<script src="../../../component/layui/layui.js"></script>
	<script src="../../../component/pear/pear.js"></script>

	<!-- 页面功能实现js -->
	<script>
		layui.use(function () {
			let tree = layui.tree;
			let $ = layui.jquery;
			$.getJSON("../../../admin/data/menu.json",function (d){
				tree.render({
					elem: '#ID-tree-demo-showCheckbox',
					data: d,
					showCheckbox: true,
					// edit: ['add', 'update', 'del'] // 开启节点的右侧操作图标
				});
			});

			$.ajax({
				url: "/api/system/role/showPrivilege",
				type:'get',
				data:JSON.stringify(data.field),
				headers:{"token":sessionStorage.token},
				success:function(result){
					layer.close(editoring);
					if(result.code == 200){
						layer.msg(result.msg,{icon:1,time:1000},function(){
							table.reload('demotable');
						});
					}else{
						layer.msg(result.msg,{icon:2,time:1000});
					}
				}
			});

		});
	</script>
</body>

</html>

